<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>修改密码－Admin</title>
<link rel="stylesheet" href="{&$skin}/html.css" type="text/css" />
<link rel="stylesheet" href="{&$skin}/admin.css" type="text/css" />
<script type="text/javascript" src="{&$js}/jquery.min.js"></script>
<script type="text/javascript" src="{&$js}/jquery.validate.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	 /**
	  * 验证执行
	  */
	  var validator = $("#pwdForm").validate({
		rules: {
			oldpass: {
				required: true
			},
			newpass: {
				required: true
			},
			repass: {
				required: true,
				equalTo: "#newpass"
			}
		},
		messages: {
			oldpass: {
				required: "请输入现在的密码"
			},
			newpass: {
				required: "请输入新密码"
			},
			repass: {
				required: "请再一次输入新密码以作确认",
				equalTo: "两次输入的密码不一样" 
			}
		},
		// 错误显示
		errorPlacement: function(error, element) {
			element.parent().append(error);
		},
		// 提交处理
		submitHandler: function() {
			$.ajax({
				type: "POST",
				url: "{@index/pwdexe}",
				data: "oldpass="+ $("#oldpass").val() +"&newpass="+ $("#newpass").val(),
				dataType: 'json',
				error: function(responseXML) {
					alert(responseXML.responseText);
				},
				success: function(result) {
					if (result.status == 1) {
						alert("密码修改成功");
						window.location.href = "{@/}";
					} else {
						alert(result.message);
					}
				}
			});
		},
		// 正确显示
		/*
		success: function(label) {
			//label.addClass("valid").text("正确");
		},
		*/
		onkeyup: false,
		onfocusout: false
	  });
});
</script>
<style type="text/css">
#pwdbox{margin:50px auto;}
form dl dt{float:left;width:120px;}
</style>
</head>
<body>
{include file='blocks/header.tpl'}


<div id="pwdbox">
<form name="pwdForm" id="pwdForm" method="post" action="{@index/pwdexe}">
<dl>
    <dt>Old Password</dt>
        <dd><input type="password" name="oldpass"  id="oldpass"  /></dd>
    <dt>New Password</dt>
        <dd><input type="password" name="newpass" id="newpass" /></dd>
    <dt>Confirm</dt>
        <dd><input type="password" name="repass" id="repass" /></dd>
    <dt>&nbsp;</dt>
        <dd><input type="submit" value="Login" /></dd>
</dl>
</form>
</div>

{include file='blocks/footer.tpl'}
</body>
</html>